package kr.hkit.androidcomplete03;

import kr.hkit.androidcomplete03.ch20.Ch20ActivityMain;
import kr.hkit.androidcomplete03.ch21.Ch21ActivityMain;
import kr.hkit.androidcomplete03.ch22.Ch22ActivityMain;
import kr.hkit.androidcomplete03.ch23.Ch23ActivityMain;
import kr.hkit.androidcomplete03.ch25.Ch25ActivityMain;
import kr.hkit.androidcomplete03.ch27.Ch27ActivityMain;
import kr.hkit.androidcomplete03.ch28.Ch28ActivityMain;
import kr.hkit.androidcomplete03.ch281.Ch281ActivityMain;
import kr.hkit.androidcomplete03.ch29.Ch29ActivityMain;
import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.os.Build;

public class MainActivity extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.chapter, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent= null;
		switch (position) {
		case 0:
			intent = new Intent(this, Ch20ActivityMain.class);
			break;
		case 1:
			intent = new Intent(this, Ch21ActivityMain.class);
			break;
		case 2:
			intent = new Intent(this, Ch22ActivityMain.class);
			break;
		case 3:
			intent = new Intent(this, Ch23ActivityMain.class);
			break;
		case 4:
			intent = new Intent(this, Ch25ActivityMain.class);
			break;
		case 5:
			intent = new Intent(this, Ch27ActivityMain.class);
			break;
		case 6:
			intent = new Intent(this, Ch28ActivityMain.class);
			break;
		case 7:
			intent = new Intent(this, Ch281ActivityMain.class);
			break;
		case 8:
			intent = new Intent(this, Ch29ActivityMain.class);
			break;
		}
		startActivity(intent);
	}
}
